def romanToInt(self, s):
  map={"I": 1,"V": 5,"X": 10,"L": 50,"C": 100,"D": 500,"M": 1000}
  result=0;index=len(s)-1
  while index>=0:
    a=map[s[index]]
    b=map[s[index-1]] if index > 0 else 0
    if a>b:
      result+=a-b
      index-=2
    else :
      result+=a
      index-=1
  return result